package com.zzptc.mzb.statisticaltable;

import android.content.Context;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;

import java.util.ArrayList;
import java.util.List;


public class ThreeFragment2 extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_three_fragment2, container, false);
        PieChart pieChart = view.findViewById(R.id.pie_chart);
        //添加数据
        List<PieEntry>pie=new ArrayList<>();
        pie.add(new PieEntry(1,"男生"));
        pie.add(new PieEntry(1,"女生"));
        pie.add(new PieEntry(1,"男生"));
        pie.add(new PieEntry(1,"女生"));
        //设置数据
        PieDataSet pieDataSet = new PieDataSet(pie,"");
        PieData pieData=new PieData(pieDataSet);
        pieChart.setData(pieData);
//设置颜色
        pieDataSet.setColors(Color.YELLOW,Color.BLACK,Color.YELLOW,Color.BLACK);



        return view;

    }
}
